
	/************************************************************************************************

		@NAPI
		Native Api

		File methods:

			b			__ni_path_valid			(path)
			b			__ni_path_relative	(path)

						__ni_create					(path)
						__ni_remove					(path)
						__ni_rename					(path, path2)
			i			__ni_exists					(path)
			n			__ni_size						(path)
			bytes	__ni_read						(path, ix, n)
						__ni_write					(path, ix, data)
						__ni_truncate				(path, n)
						__ni_move						(path, path2)
						__ni_copy						(path, path2)
						__ni__add						(path, path2)

		Dir methods:
			cwd		__ni_cwd						(path*)
						__ni_create					(path)
						__ni_remove					(path)
			ls		__ni_read						(path)
						__ni_rename					(path, path2)
			b			__ni_empty					(path)
			b			__ni_exists					(path)
						__ni_move						(path, path2)
						__ni_copy						(path, path2)

	************************************************************************************************/

	//Os
	//---------------------------------------------------------------------------
	if(jsl.info("system.os") === "Windows") {

		//---------------------------------------------------------------------------
		jsl.File.__ni_path_valid = function(path) {
			//allow also /foo
			return !!path.match(/^([^:]+:|[^\\\/:*?"<>|%]+)?(\/[^\\\/:*?"<>|%]+)*\/?$/)
		}

		//---------------------------------------------------------------------------
		jsl.File.__ni_path_relative = function(path) {
			return !path.match(/^[a-zA-Z]:/)
		}
	}
	else {
		//---------------------------------------------------------------------------
		jsl.File.__ni_path_valid = function(path) {
			return !!path.match(/^[^\\\/:*?"<>|%]?(\/[^\\\/:*?"<>|%]+)*\/?$/)
		}

		//---------------------------------------------------------------------------
		jsl.File.__ni_path_relative = function(path) {
			return path.indexOf("/")
		}
	}

	//1-LiquidBox
	//---------------------------------------------------------------------------
	if(jsl.__sys === "LiquidBox") {

	//File
	//---------------------------------------------------------------------------
	jsl.File.__ni_create = function(path) {
		try {
			__ni_fle_create(path)
		}
		catch(e) {
			jsl.throwError(e, this, arguments)
		}
	}
	//---------------------------------------------------------------------------
	jsl.File.__ni_remove = function(path) {
		try {
			__ni_fle_remove(path)
		}
		catch(e) {
			jsl.throwError(e, this, arguments)
		}
	}
	//---------------------------------------------------------------------------
	jsl.File.__ni_rename = function(path, path2) {
		try {
			__ni_fle_rename(path, path2)
		}
		catch(e) {
			jsl.throwError(e, this, arguments)
		}
	}
	//---------------------------------------------------------------------------
	jsl.File.__ni_exists = function(path) {
		try {
			var p

			if(path.match(/^[a-zA-Z]:$/)) p = path + "/"
			else p = path

			if(__ni_fle_exists(p)) 				return 1
			else if(__ni_fle_dexists(p))	return 2
			else													return 0
		}
		catch(e) {
			jsl.throwError(e, this, arguments)
		}
	}
	//---------------------------------------------------------------------------
	jsl.File.__ni_size = function(path) {
		try {
			return __ni_fle_size(path)
		}
		catch(e) {
			jsl.throwError(e, this, arguments)
		}
	}
	//---------------------------------------------------------------------------
	jsl.File.__ni_read = function(path, ix, n) {
		try {
			return __ni_fle_read(path, ix, n)
		}
		catch(e) {
			jsl.throwError(e, this, arguments)
		}
	}
	//---------------------------------------------------------------------------
	jsl.File.__ni_write = function(path, ix, data) {
		try {
			__ni_fle_write(path, ix, data)
		}
		catch(e) {
			jsl.throwError(e, this, arguments)
		}
	}
	//---------------------------------------------------------------------------
	jsl.File.__ni_truncate = function(path, n) {
		try {
			__ni_fle_truncate(path, n)
		}
		catch(e) {
			jsl.throwError(e, this, arguments)
		}
	}
	//---------------------------------------------------------------------------
	jsl.File.__ni_move = function(path, path2) {
		try {
			__ni_fle_move(path, path2)
		}
		catch(e) {
			jsl.throwError(e, this, arguments)
		}
	}
	//---------------------------------------------------------------------------
	jsl.File.__ni_copy = function(path, path2) {
		try {
			__ni_fle_copy(path, path2)
		}
		catch(e) {
			jsl.throwError(e, this, arguments)
		}
	}
	//---------------------------------------------------------------------------
	jsl.File.__ni_add = function(path, path2) {
		try {
			__ni_fle_add(path, path2)
		}
		catch(e) {
			jsl.throwError(e, this, arguments)
		}
	}

	//Dir
	//---------------------------------------------------------------------------
	jsl.Dir.__ni_cwd = function(path) {
		try {
			if(!arguments.length) return __ni_fle_dcwd()
			else __ni_fle_dcwd(path)
		}
		catch(e) {
			jsl.throwError(e, this, arguments)
		}
	}
	//---------------------------------------------------------------------------
	jsl.Dir.__ni_create = function(path) {
		try {
			__ni_fle_dcreate(path)
		}
		catch(e) {
			jsl.throwError(e, this, arguments)
		}
	}
	//---------------------------------------------------------------------------
	jsl.Dir.__ni_remove = function(path) {
		try {
			__ni_fle_dremove(path)
		}
		catch(e) {
			jsl.throwError(e, this, arguments)
		}
	}
	//---------------------------------------------------------------------------
	jsl.Dir.__ni_read = function(path) {
		try {
			var ls = __ni_fle_dread(path)
			ls.sort()
			return ls
		}
		catch(e) {
			jsl.throwError(e, this, arguments)
		}
	}
	//---------------------------------------------------------------------------
	jsl.Dir.__ni_rename = function(path, path2) {
		try {
			__ni_fle_drename(path, path2)
		}
		catch(e) {
			jsl.throwError(e, this, arguments)
		}
	}
	//---------------------------------------------------------------------------
	jsl.Dir.__ni_empty = function(path) {
		try {
			return __ni_fle_dempty(path)
		}
		catch(e) {
			jsl.throwError(e, this, arguments)
		}
	}
	//---------------------------------------------------------------------------
	jsl.Dir.__ni_exists = function(path) {
		try {
			var p

			if(path.match(/^[a-zA-Z]:$/)) p = path + "/"
			else p = path

			if(__ni_fle_dexists(p)) 		return 2
			else if(__ni_fle_exists(p))	return 1
			else												return 0
		}
		catch(e) {
			jsl.throwError(e, this, arguments)
		}
	}
	//---------------------------------------------------------------------------
	jsl.Dir.__ni_move = function(path, path2) {
		try {
			__ni_fle_dmove(path, path2)
		}
		catch(e) {
			jsl.throwError(e, this, arguments)
		}
	}
	//---------------------------------------------------------------------------
	jsl.Dir.__ni_copy = function(path, path2) {
		try {
			__ni_fle_dcopy(path, path2)
		}
		catch(e) {
			jsl.throwError(e, this, arguments)
		}
	}

	}
	//2-Not supported
	//---------------------------------------------------------------------------
	else	throw jsl.NativeError("LibraryNotSupported:File")
